
/*******************************************************
pattern
find match string pattern and reuse again
********************************************************/

import java.util.regex.*;

public class Main { 
    public static void main(String[] args) { 
	String phone1=	"justin's\tphone number:0911-223344\n"+
			"kelly's\tphone number:0912-998877";

	Pattern pattern=Pattern.compile(".*09[0-9-]*");
//	Pattern pattern=Pattern.compile(".*0911-\\d{6}");

	Matcher matcher=pattern.matcher(phone1);

	while(matcher.find()){
		System.out.println(matcher.group());
	}

	String phone2=	"dd's\tphone number:0933-000000\n"+
			"cc's\tphone number:0944-111111";

	matcher=pattern.matcher(phone2);

	while(matcher.find()){
		System.out.println(matcher.group());
	}
    } 
} 
